Yacon.widget.TFrame = function(conText){
	
	Yacon.apply(this,conText);
	
	this.baseCreate();
	
};

Yacon.widget.TFrame.prototype = {
		
	baseCreate: function(){
		this.elementID = this.view.id;
		this.elementType = this.view.type;
		this.dataSet = new Yacon.data.DataSet(this.page);
	},
	
	/* 获取HTML信息 */	
	getHtml: function(){
		
		var html = "<div ";
		
		html += " lily-id='"+this.elementID+"' lily-type='"+this.elementType+"' ";
		
		html += ">";
		
		html += "<div id='"+this.elementID+"_window'>";
		
		html += "<div class='lily-frame col row-ht-inner class-frame' parentid='"+this.elementID+"'></div>";
		
		html += "</div>";
		
		html += "</div>";
		
		return html;
	},
	
	show: function(){
		
		if(this.elementID){
			
			if(Yacon.isEmpty(this.view.url) || "about:blank;" == this.view.url || "about:blank" == this.view.url){
				return;
			}
			
			this.dataSet.switchWindow({
				url : this.view.url
			});
			
			var search = this.page.element.search + " div[lily-id='"+this.elementID+"'][lily-type='"+this.elementType+"'] ";		
			this.winHeight = $(search).parent().height();
			this.winWidth = $(search).parent().width();
			
			/* JS填充 */
			$(search +" .lily-frame").append(this.dataSet.rsp);
			
			if(Yacon.isEmpty(window.page)){
				return;
			}
			
			/* HTML填充 */
			this.framePage = window.page;
			this.framePage.frame = this;
			this.framePage.element.height = this.winHeight;
			this.framePage.element.width = this.winWidth;
			this.framePage.element.search = search;
			
			$(search +" .lily-frame").append(this.framePage.getHtml());
			
			//清除上边距
			$(search +" .lily-frame > div.row:first").css("padding-top","0px");			
			
			//布局处理
			this.framePage.layout();
			
			/* 绑定动作 */
			this.framePage.addEvents();
			
		}
		
	},
	
	/* 情况信息 */
	clear: function(){
		if(this.elementID){			
			var search = this.page.element.search + " div[lily-id='"+this.elementID+"'][lily-type='"+this.elementType+"']";			
			$(search +" .lily-frame").empty();
		}
	},
	
	addEvents: function(){		
			
	},
	
	layoutBefore: function(){
		this.show();
	}
		
};